package app.kotlin_1.utils

import android.view.View

/**
 * Created by 刘智强 on 2017/10/24.
 */
 abstract  class  OnMultiClickListener :View.OnClickListener{
    // 两次点击按钮之间的点击间隔不能少于1000毫秒
    private val MIN_CLICK_DELAY_TIME = 5000
    private var lastClickTime: Long = 0

    abstract fun onMultiClick(v: View)
    override fun onClick(v: View?) {
        val curClickTime = System.currentTimeMillis()
        error("11111")
        if (curClickTime - lastClickTime >= MIN_CLICK_DELAY_TIME) {
            // 超过点击间隔后再将lastClickTime重置为当前点击时间

            lastClickTime = curClickTime
            onMultiClick(v!!)
        }

    }

}